A write error sometimes occurs in a semiconductor memory device. For example, to detect a write error, the semiconductor memory device stores data (to be referred to as first data hereinafter) which is write target data and is not written in a memory mat (memory array), in a memory device different from the memory mat, and writes the write target data in the memory mat. Then, the semiconductor memory device reads out the write target data written in the memory mat. The semiconductor memory device compares first data stored in the other memory device with the data (to be referred to as second data hereinafter) written in and read out from the memory mat, and determines whether the second data is valid.
If an error is detected in the second data (if the data is not correctly written), a normal semiconductor memory device rewrites the write target data in the memory mat. When a long write time is allowable, a rewrite operation is allowed to produce a delay in a processing time. However, if it is necessary to sequentially write data in the memory mat and a throughput is important, a processing delay caused by this rewrite operation may pose a problem. Also, if the rewrite operation is performed when sequentially reading out second data, a memory controller or processor (e.g., a central processing unit) waits until the rewrite operation is complete. Consequently, a processing delay occurs in, e.g., a real-time application, and this waiting state may make it difficult to ensure real-time properties.
In addition, an error such as a cell inversion error sometimes occurs in the semiconductor memory device. If this error has occurred, the semiconductor memory device executes an operation of correcting the error of data read out from the memory mat, and rewriting corrected data in the memory mat.
When a long data read time is allowable, this rewrite operation is allowed to produce a delay in data read or write. However, if the above-mentioned rewrite operation is executed when it is necessary to sequentially perform data read or write and a throughput is important, the memory controller or processor waits during this rewrite operation and may produce a delay in data read or write. In the real-time application, for example, this waiting state sometimes makes it difficult to ensure the real-time properties.
Furthermore, when the semiconductor memory device includes a function of correcting an error in readout data, the number of error bits may increase to make error correction impossible if the above-mentioned rewrite operation is not performed.